package com.czh.entity;

import com.czh.constant.HttpConstants;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

/**
 * @author chenzhihua
 * @desc TODO
 * @date 2024/1/9
 * @Version V1.1.0
 */
@Data
@Builder
public class RpcResponse implements Serializable {

    private int code;

    private String message;

    private Object data;

    public static RpcResponse success(Object data) {
        return RpcResponse.builder().code(HttpConstants.HttpCode.SUCCESS).message("success").data(data).build();
    }

    public static RpcResponse fail() {
        return RpcResponse.builder().code(HttpConstants.HttpCode.FAIL).message("fail").build();
    }
}
